<!DOCTYPE html>
<html>
<head>
    <title>图书列表</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
            max-width: 1000px;
            margin: 0 auto;
            padding: 40px 20px;
            background: linear-gradient(135deg, #f6f8f9 0%, #e5ebee 100%);
            min-height: 100vh;
        }
        h1 {
            color: #2c3e50;
            text-align: center;
            margin-bottom: 40px;
            font-size: 2.5em;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
            letter-spacing: 1px;
        }
        .add-button {
            display: inline-block;
            padding: 14px 32px;
            background: linear-gradient(45deg, #4CAF50, #45a049);
            color: white;
            text-decoration: none;
            border-radius: 30px;
            margin-bottom: 30px;
            transition: all 0.4s ease;
            box-shadow: 0 4px 15px rgba(76,175,80,0.2);
            font-weight: 500;
            letter-spacing: 0.5px;
        }
        .add-button:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 20px rgba(76,175,80,0.3);
            background: linear-gradient(45deg, #45a049, #4CAF50);
        }
        table {
            width: 100%;
            border-collapse: separate;
            border-spacing: 0;
            background-color: white;
            box-shadow: 0 8px 30px rgba(0,0,0,0.08);
            border-radius: 20px;
            overflow: hidden;
        }
        th, td {
            padding: 20px 25px;
            text-align: left;
        }
        th {
            background: linear-gradient(45deg, #4CAF50, #45a049);
            color: white;
            font-weight: 500;
            font-size: 1.1em;
            letter-spacing: 0.8px;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
        }
        td {
            border-bottom: 1px solid rgba(238,238,238,0.7);
            transition: all 0.3s ease;
            color: #2c3e50;
        }
        tr:last-child td {
            border-bottom: none;
        }
        tr:hover td {
            background-color: rgba(76,175,80,0.03);
            transform: scale(1.01);
        }
        .search-form {
            margin-bottom: 30px;
            display: flex;
            gap: 10px;
        }
        .search-input {
            flex: 1;
            padding: 12px 20px;
            border: 2px solid #e5ebee;
            border-radius: 30px;
            font-size: 16px;
            transition: all 0.3s ease;
        }
        .search-input:focus {
            outline: none;
            border-color: #4CAF50;
            box-shadow: 0 0 10px rgba(76,175,80,0.1);
        }
        .search-button {
            padding: 12px 30px;
            background: linear-gradient(45deg, #4CAF50, #45a049);
            color: white;
            border: none;
            border-radius: 30px;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        .search-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(76,175,80,0.2);
        }
    </style>
</head>
<body>
    <h1>图书列表</h1>
    <form method="get" class="search-form">
        <input type="text" name="search" placeholder="搜索书名或作者..." class="search-input" value="{{ request.GET.search }}">
        <button type="submit" class="search-button">搜索</button>
    </form>
    <a href="{% url 'add_book' %}" class="add-button">添加新书</a>
    <table>
        <tr>
            <th>书名</th>
            <th>作者</th>
            <th>出版日期</th>
        </tr>
        {% for book in books %}
        <tr>
            <td>{{ book.title }}</td>
            <td>{{ book.author }}</td>
            <td>{{ book.publish_date }}</td>
        </tr>
        {% endfor %}
    </table>
</body>
</html>
